﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="pPaises.aspx.cs" Inherits="pPaises" %>

<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxHiddenField" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCloudControl" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.2, Version=11.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxPopupControl" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <script type="text/javascript">
    // <![CDATA[

        var postponedCallbackValue = null;
        var primeraVez = true;

        function OnGridFocusedRowChanged() {
            gvGrilla.GetRowValues(gvGrilla.GetFocusedRowIndex(), 'IDPais;NombrePais', OnGetRowValues);
        }

        function OnGetRowValues(values) {
            if (primeraVez != true) {
                if (values[0] != null) {
                    cpDetalle.PerformCallback("MOSTRAR|" + values[0])
                    rpDetalle.SetVisible(true);
                }
                else {
                    rpDetalle.SetVisible(false);
                }
                
            }
            else {
                primeraVez = false;
            }
        }

        //        function BtnGuardarClick(s, e) {
        //            if (ASPxClientEdit.ValidateGroup('valGrupo')) {
        //                ASPxClientEdit.ClearGroup('valGrupo');
        //                cpDetalle.PerformCallback("GUARDAR");
        //                rpDetalle.SetVisible(false);
        //            }
        //        }

        //        function BtnEliminarClick(s, e) {
        //            var puedeEliminar = HidenElimino.Get("ELIMINO");
        //            alert(puedeEliminar);
        //            if (puedeEliminar == "TRUE") {
        //                //Si no tiene registros asociados, dejamos eliminar el objeto.
        //                lblDeseaContinuar.SetVisible(true);
        //                lblSeguroDeseaEliminar.SetText("El Pais: " + txtIDPais.GetText() + " - " + txtNombrePais.GetText() + " va a ser eliminado.");
        //                btnPopEliminar.SetVisible(true);
        //            }
        //            else {
        //                //Si tiene asociado algún registro, le muestro que no lo 
        //                //puedo eliminar
        //                lblDeseaContinuar.SetVisible(false);
        //                lblSeguroDeseaEliminar.SetText("El Pais: " + txtIDPais.GetText() + " - " + txtNombrePais.GetText() + " no puede ser eliminado por que posee negocios asociados, debe eliminar los negocios para poder continuar");
        //                btnPopEliminar.SetVisible(false);
        //            }
        //            popConfirmar.Show();
        //        }

        //        function btnVolverClick(s, e) {
        //            rpDetalle.SetVisible(false);
        //        }

        //        function btnPopVolverClick(s, e) {
        //            popConfirmar.Hide();
        //        }

        //        function btnPopEliminarClick(s, e) {
        //            popConfirmar.Hide();
        //            cpDetalle.PerformCallback("ELIMINAR");
        //}
        // ]]> 
    </script>
    <div style="float: left; width: 100%">
        <table>
            <tr>
                <td align="left" valign="middle">
                    <dx:ASPxLabel ID="ASPxLabel4" runat="server" Font-Bold="True" Font-Size="Small"
                        Text="Nuevo">
                    </dx:ASPxLabel>
                </td>
                <td>
                    <dx:ASPxImage ID="btnNuevo" runat="server" ImageUrl="~/Imagenes/Add.png" ToolTip="Nuevo"
                        Width="50px" ClientInstanceName="btnNuevo">
                    </dx:ASPxImage>
                </td>
            </tr>
        </table>
    </div>
    <div style="float: left; width: 45%">
        <dx:ASPxGridView ID="gvGrilla" runat="server" AutoGenerateColumns="False" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
            CssPostfix="DevEx" Width="380px" Font-Bold="True" Font-Size="Small" ClientInstanceName="gvGrilla"
            KeyFieldName="IDPais" Caption="Paises">
            <SettingsBehavior AllowFocusedRow="True" />
            <ClientSideEvents FocusedRowChanged="function(s, e) { OnGridFocusedRowChanged(); }" />
            <Settings ShowFilterRow="True" />
            <Columns>
                <dx:GridViewCommandColumn Name="botones" VisibleIndex="0" ButtonType="Image" Caption="Seleccionar"
                    Width="25px">
                    <CustomButtons>
                        <dx:GridViewCommandColumnCustomButton ID="Nuevo" Image-ToolTip="Editar">
                            <Image Url="~/Imagenes/qetto_icons_part_2_png/wordbook.png" Width="27" Height="27">
                            </Image>
                        </dx:GridViewCommandColumnCustomButton>
                        <%--                        <dx:GridViewCommandColumnCustomButton ID="Editar">
                            <Image Url="Imagenes/Pencil.png" Width="27" Height="27">
                            </Image>
                        </dx:GridViewCommandColumnCustomButton>
                        <dx:GridViewCommandColumnCustomButton ID="Eliminar">
                            <Image Url="Imagenes/Cross.png" Width="27" Height="27">
                            </Image>
                        </dx:GridViewCommandColumnCustomButton>--%>
                    </CustomButtons>
                    <HeaderStyle Font-Bold="True" Font-Size="Small" />
                </dx:GridViewCommandColumn>
                <dx:GridViewDataTextColumn Caption="Nombre" FieldName="NombrePais" Name="NombrePais"
                    ShowInCustomizationForm="True" VisibleIndex="2" Width="150px">
                    <PropertiesTextEdit>
                        <ValidationSettings ErrorText="Valor inválido">
                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                        </ValidationSettings>
                    </PropertiesTextEdit>
                    <HeaderStyle Font-Bold="True" Font-Size="Small" />
                    <CellStyle Font-Size="Small">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
                <dx:GridViewDataTextColumn Caption="ID País" FieldName="IDPais" Name="IDPais" ShowInCustomizationForm="True"
                    VisibleIndex="1" Width="40px">
                    <PropertiesTextEdit>
                        <ValidationSettings ErrorText="Valor inválido">
                            <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                        </ValidationSettings>
                    </PropertiesTextEdit>
                    <HeaderStyle Font-Bold="True" Font-Size="Small" />
                    <CellStyle Font-Size="Small">
                    </CellStyle>
                </dx:GridViewDataTextColumn>
            </Columns>
            <SettingsText EmptyDataRow="No se encontraron datos" 
                HeaderFilterShowBlanks="No se encontraron datos" 
                HeaderFilterShowNonBlanks="No se encontraron datos" />
            <Images SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css">
                <LoadingPanelOnStatusBar Url="~/App_Themes/DevEx/GridView/StatusBarLoading.gif">
                </LoadingPanelOnStatusBar>
                <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                </LoadingPanel>
            </Images>
            <ImagesFilterControl>
                <LoadingPanel Url="~/App_Themes/DevEx/GridView/Loading.gif">
                </LoadingPanel>
            </ImagesFilterControl>
            <Styles CssFilePath="~/App_Themes/DevEx/{0}/styles.css" CssPostfix="DevEx">
                <Header ImageSpacing="5px" SortingImageSpacing="5px" Font-Bold="False">
                </Header>
                <HeaderPanel Font-Bold="True" Font-Size="Medium" HorizontalAlign="Left">
                </HeaderPanel>
                <LoadingPanel ImageSpacing="5px">
                </LoadingPanel>
                <TitlePanel Font-Bold="True">
                </TitlePanel>
            </Styles>
            <StylesEditors ButtonEditCellSpacing="0">
                <ProgressBar Height="21px">
                </ProgressBar>
            </StylesEditors>
        </dx:ASPxGridView>
    </div>
    <div style="float: right; vertical-align:top; width: 52%">
        <dx:ASPxRoundPanel HeaderText="Paises" ID="rpDetalle" ClientInstanceName="rpDetalle"
            runat="server" Width="200px" BackColor="White" CssFilePath="~/App_Themes/DevEx/{0}/styles.css"
            CssPostfix="DevEx" EnableDefaultAppearance="False" GroupBoxCaptionOffsetX="6px"
            GroupBoxCaptionOffsetY="-19px" SpriteCssFilePath="~/App_Themes/DevEx/{0}/sprite.css"
            ClientVisible="False">
            <ContentPaddings PaddingBottom="10px" PaddingLeft="7px" PaddingRight="11px" PaddingTop="10px" />
            <HeaderStyle BackColor="#DEDEDE">
                <Paddings PaddingBottom="6px" PaddingLeft="7px" PaddingRight="11px" PaddingTop="1px" />
                <BorderLeft BorderStyle="None" />
                <BorderRight BorderStyle="None" />
                <BorderBottom BorderStyle="None" />
            </HeaderStyle>
            <TopLeftCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/TopLeftCorner.png"
                Width="5px">
            </TopLeftCorner>
            <NoHeaderTopLeftCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/NoHeaderTopLeftCorner.png"
                Width="5px">
            </NoHeaderTopLeftCorner>
            <TopRightCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/TopRightCorner.png"
                Width="5px">
            </TopRightCorner>
            <NoHeaderTopRightCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/NoHeaderTopRightCorner.png"
                Width="5px">
            </NoHeaderTopRightCorner>
            <BottomRightCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/BottomRightCorner.png"
                Width="5px">
            </BottomRightCorner>
            <BottomLeftCorner Height="5px" Url="~/Images/ASPxRoundPanel/718663734/BottomLeftCorner.png"
                Width="5px">
            </BottomLeftCorner>
            <HeaderLeftEdge>
                <BackgroundImage HorizontalPosition="left" ImageUrl="~/Images/ASPxRoundPanel/718663734/HeaderLeftEdge.png"
                    Repeat="NoRepeat" VerticalPosition="bottom" />
            </HeaderLeftEdge>
            <HeaderContent>
                <BackgroundImage HorizontalPosition="left" ImageUrl="~/Images/ASPxRoundPanel/718663734/HeaderContent.png"
                    Repeat="RepeatX" VerticalPosition="bottom" />
            </HeaderContent>
            <HeaderRightEdge>
                <BackgroundImage HorizontalPosition="right" ImageUrl="~/Images/ASPxRoundPanel/718663734/HeaderRightEdge.png"
                    Repeat="NoRepeat" VerticalPosition="bottom" />
            </HeaderRightEdge>
            <PanelCollection>
                <dx:PanelContent ID="PanelContent1" runat="server" SupportsDisabledAttribute="True">
                    <dx:ASPxCallbackPanel ID="cpDetalle" runat="server" ClientInstanceName="cpDetalle"
                        OnCallback="cpDetalle_Callback">
                        <PanelCollection>
                            <dx:PanelContent ID="PanelContentDetalle" runat="server">
                                <table align="left" class="style2">
                                    <tr>
                                        <td align="center" colspan="2">
                                            <dx:ASPxLabel ID="lblAccion" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                                CssPostfix="BlackGlass" Font-Bold="True" Font-Italic="False" Font-Size="Small"
                                                Text="Datos del País">
                                            </dx:ASPxLabel>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dx:ASPxLabel ID="ASPxLabel2" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
                                                CssPostfix="Aqua" Font-Bold="True" Font-Italic="False" Font-Size="Small" Text="ID País">
                                            </dx:ASPxLabel>
                                        </td>
                                        <td>
                                            <dx:ASPxTextBox ID="txtIDPais" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                                CssPostfix="BlackGlass" Enabled="False" SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css"
                                                Style="margin-bottom: 0px" Width="30px">
                                                <ValidationSettings ErrorText="Valor inválido">
                                                    <ErrorFrameStyle ImageSpacing="4px">
                                                        <ErrorTextPaddings PaddingLeft="4px" />
                                                        <ErrorTextPaddings PaddingLeft="4px" />
                                                    </ErrorFrameStyle>
                                                    <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                                    <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                                </ValidationSettings>
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <dx:ASPxLabel ID="ASPxLabel3" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                                CssPostfix="BlackGlass" Font-Bold="True" Font-Italic="False" Font-Size="Small"
                                                Text="Nombre">
                                            </dx:ASPxLabel>
                                        </td>
                                        <td>
                                            <dx:ASPxTextBox ID="txtNombrePais" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                                CssPostfix="BlackGlass" SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css"
                                                Width="180px">
                                                <ValidationSettings ErrorText="Valor inválido">
                                                    <ErrorFrameStyle ImageSpacing="4px">
                                                        <ErrorTextPaddings PaddingLeft="4px" />
                                                        <ErrorTextPaddings PaddingLeft="4px" />
                                                    </ErrorFrameStyle>
                                                    <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                                    <RegularExpression ErrorText="Falló la validación de expresión Regular" />
                                                </ValidationSettings>
                                            </dx:ASPxTextBox>
                                        </td>
                                        <td>
                                            <%--<asp:RequiredFieldValidator ID="valNombre" runat="server" 
                                                ControlToValidate="txtNombrePais" ErrorMessage="RequiredFieldValidator" 
                                                Font-Bold="True" Font-Size="Medium" ForeColor="Red" ValidationGroup="valGrupo">*</asp:RequiredFieldValidator>--%>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <%--<dx:ASPxValidationSummary ID="valGrupo" runat="server" ClientIDMode="AutoID" 
                                                ClientInstanceName="valGrupo" Width="234px">
                                            </dx:ASPxValidationSummary>--%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <table align="center">
                                                <tr>
                                                    <td>
                                                        <dx:ASPxImage ID="btnGuardar" runat="server" ImageUrl="~/Imagenes/check.png" ToolTip="Guardar"
                                                            Width="50px" ClientInstanceName="btnGuardar">
                                                        </dx:ASPxImage>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxImage ID="btnEliminar" runat="server" ImageUrl="~/Imagenes/noBlanco.png"
                                                            ToolTip="Eliminar" Width="50px" ClientInstanceName="btnEliminar">
                                                        </dx:ASPxImage>
                                                    </td>
                                                    <td>
                                                        <dx:ASPxImage ID="btnVolver" runat="server" ImageUrl="~/Imagenes/shortcut.png" ToolTip="Volver"
                                                            Width="50px" ClientInstanceName="btnVolver" BackColor="#DFDFDF">
                                                        </dx:ASPxImage>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="3">
                                            <dx:ASPxHiddenField ID="Hiden" runat="server" ClientInstanceName="Hiden">
                                            </dx:ASPxHiddenField>
                                        </td>
                                    </tr>
                                </table>
                            </dx:PanelContent>
                        </PanelCollection>
                    </dx:ASPxCallbackPanel>
                </dx:PanelContent>
            </PanelCollection>
            <Border BorderColor="#8B8B8B" BorderStyle="Solid" BorderWidth="1px" />
        </dx:ASPxRoundPanel>
    </div>
    <dx:ASPxPopupControl ID="popConfirmar" runat="server" CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="popConfirmar"
        HeaderText="Confirmar Eliminación" AllowDragging="True" EnableAnimation="False"
        EnableViewState="False" Width="248px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); tbLogin.Focus(); }" />
        <ContentCollection>
            <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                <dx:ASPxPanel ID="Panel1" runat="server" DefaultButton="btOK">
                    <PanelCollection>
                        <dx:PanelContent ID="PanelContent2" runat="server">
                            <table align="left" class="style2">
                                <tr>
                                    <td colspan="2" align="center">
                                        <dx:ASPxLabel ID="lblSeguroDeseaEliminar" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                            CssPostfix="BlackGlass" Font-Bold="True" Font-Italic="False" Font-Size="Small"
                                            Text="El País ARGENTINA será eliminado" ClientInstanceName="lblSeguroDeseaEliminar">
                                        </dx:ASPxLabel>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center">
                                        <dx:ASPxLabel ID="lblDeseaContinuar" runat="server" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css"
                                            CssPostfix="BlackGlass" Font-Bold="True" Font-Italic="False" Font-Size="Small"
                                            Text="¿Desea continuar?" ClientInstanceName="lblDeseaContinuar">
                                        </dx:ASPxLabel>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center" valign="middle">
                                        <dx:ASPxImage ID="btnPopEliminar" runat="server" ImageUrl="~/Imagenes/no.png" ToolTip="Eliminar"
                                            Width="50px" ClientInstanceName="btnPopEliminar">
                                        </dx:ASPxImage>
                                        <dx:ASPxImage ID="btnPopVolver" runat="server" ImageUrl="~/Imagenes/shortcut.png"
                                            ToolTip="Volver" Width="50px" ClientInstanceName="btnPopVolver">
                                        </dx:ASPxImage>
                                    </td>
                                </tr>
                            </table>
                        </dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxPanel>
            </dx:PopupControlContentControl>
        </ContentCollection>
        <ContentStyle>
            <Paddings PaddingBottom="5px" />
        </ContentStyle>
        <Border BorderColor="#CCCCCC" BorderStyle="Groove" />
    </dx:ASPxPopupControl>
</asp:Content>
